package ru.xeden.web.internal;

import java.util.Map;

import javax.servlet.ServletException;

import org.osgi.service.http.HttpService;
import org.osgi.service.http.NamespaceException;

public class ServletRegister
{
    
    private XedenServlet xedenServlet;
    
    public void setXedenServlet(XedenServlet xedenServlet)
    {
        this.xedenServlet = xedenServlet;
    }
    
    public void httpServiceBind(HttpService service, Map properties)
    {
        try
        {
            service.registerServlet("/xeden", xedenServlet, null, null);
        }
        catch (ServletException e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        catch (NamespaceException e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    public void httpServiceUnbind(HttpService service, Map properties)
    {
        service.unregister("/xeden");
    }
}
